package com.czk.factoryBean;

import com.czk.Student;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * 此时会向容器中注册MyFactoryBean和Student两个对象
 * student对应的名称是myFactoryBean,MyFactoryBean对应的名称是&myFactoryBean
 *
 * @Author:ChenZhangKun
 * @Date: 2021/4/28 16:05
 */
@Component
public class MyFactoryBean implements FactoryBean {
    @Override
    public Object getObject() throws Exception {
        return new Student("czk", 25);
    }

    @Override
    public Class<?> getObjectType() {
        return Student.class;
    }
}
